﻿@page "/"
@using Remotely.Server.Services
@using Remotely.Shared.Models
@namespace Remotely.Server.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@inject IDataService DataService
@inject IApplicationConfig AppConfig

@{
    Layout = null;
    var user = DataService.GetUserByNameWithOrg(User?.Identity?.Name);
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=550, user-scalable=no" />
    <title>Remotely</title>
    <base href="~/" />
    <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
    <link href="css/site.css" rel="stylesheet" />
    <link href="Remotely_Server.styles.css" rel="stylesheet" />
    <script src="~/interop.js"></script>

    @if (user is RemotelyUser)
    {

        switch (user.UserOptions.Theme)
        {
            case Remotely.Shared.Enums.Theme.Light:
                <link rel="stylesheet" href="~/css/Themes/yeti.min.css" />
                <link rel="stylesheet" href="~/css/Themes/yeti.custom.css" asp-append-version="true" />
                break;
            case Remotely.Shared.Enums.Theme.Dark:
                <link rel="stylesheet" href="~/css/Themes/darkly.min.css" />
                <link rel="stylesheet" href="~/css/Themes/darkly.custom.css" asp-append-version="true" />
                break;
            default:
                break;
        }
    }
    else
    {
        if (AppConfig.Theme == Remotely.Shared.Enums.Theme.Light)
        {
            <link rel="stylesheet" href="~/css/Themes/yeti.min.css" />
            <link rel="stylesheet" href="~/css/Themes/yeti.custom.css" asp-append-version="true" />
        }
        else
        {
            <link rel="stylesheet" href="~/css/Themes/darkly.min.css" />
            <link rel="stylesheet" href="~/css/Themes/darkly.custom.css" asp-append-version="true" />
        }
    }

</head>
<body>
    <component type="typeof(App)" render-mode="ServerPrerendered" />

    <div id="blazor-error-ui">
        <environment include="Staging,Production">
            An error has occurred. This application may no longer respond until reloaded.
        </environment>
        <environment include="Development">
            An unhandled exception has occurred. See browser dev tools for details.
        </environment>
        <a href="" class="reload">Reload</a>
        <a class="dismiss">🗙</a>
    </div>

    <script src="_framework/blazor.server.js"></script>
</body>
</html>
